package com.qumitech.visualnovel.service.game.impl;

import com.alibaba.fastjson.JSONObject;
import com.qumitech.visualnovel.component.util.HttpInvokeUtil;
import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.common.UrlConstant;
import com.qumitech.visualnovel.service.game.GameService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class GameServiceImpl implements GameService {
    @Override
    public BaseRsp listGameCfg() {
        String url = UrlConstant.SERVER_URL + "/admin/game/cfg";
        String body = HttpInvokeUtil.httpGet(url, new HashMap<>());
        return JSONObject.parseObject(body, BaseRsp.class);
    }

    @Override
    public BaseRsp listUserGameAccount(Map<String, Object> reqMap) {
        String url = UrlConstant.SERVER_URL + "/admin/game/account";
        String body = HttpInvokeUtil.httpGet(url, reqMap);
        return JSONObject.parseObject(body, BaseRsp.class);
    }
}
